from classes import track


def get_template(track: track.FlacTrack):
    genres = track.getGenre("/")
    subgenres = [
        subgenre for subgenre in track.getSubgenre("/") if not subgenre in genres
    ]

    template = f"{track.artist} — {track.title}\n"

    template += "Genre: "
    for genre in genres:
        template += f"{genre}, "
    template = template[:-2]

    template += "\nSubgenre: "
    for subgenre in subgenres:
        template += f"{subgenre}, "
    template = template[:-2]

    template += f"\nRelease Date: {track.getReleaseDate().strftime('%d %B %Y')}\n\n"
    template += f"# #Single\n\n"
    for artist in track.getArtist():
        template += f"#{artist.replace(' ', '').replace('.', '')} "
    template = template[:-1]
    template += "\n\n"

    for genre in genres:
        template += f"#{genre.replace(' ', '').replace('-', '').replace('&', 'and').replace('’', '')} "
    template = template[:-1]
    template += "\n"

    for subgenre in subgenres:
        template += f"#{subgenre.replace(' ', '').replace('-', '').replace('&', 'and').replace('’', '')} "
    template = template[:-1]

    return template
